import Cookies from 'js-cookie';

const app = {
    state: {
        table: {
            pageSize: +Cookies.get('pageSize') || 10,
            pageSizes: [10, 25, 50]
        }
    },
    mutations: {
        CHANGE_PAGE_SIZE: (state, pageSize) => {
            Cookies.set('pageSize', pageSize);
            state.table.pageSize = pageSize;
        }
    },
    actions: {
        ChangePageSize: ({ commit }, pageSize) => {
            commit('CHANGE_PAGE_SIZE', pageSize)
        }
    }
};

export default app;
